package deng.camel.beans.processors;

import java.util.concurrent.CountDownLatch;

import org.apache.camel.Exchange;

public class CountDownLatchProcessor extends ProcessorSupport {
	
	private CountDownLatch countDownLatch;
	
	public CountDownLatch getCountDownLatch() {
		return countDownLatch;
	}
	
	public CountDownLatchProcessor(CountDownLatch countDownLatch) {
		this.countDownLatch = countDownLatch;
	}
	
	@Override
	public void process(Exchange exchange) throws Exception {
		logger.trace("Decrement the latch from " + countDownLatch.getCount());
		countDownLatch.countDown();
	}

}
